package com.lst.projectlib.db;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;

import com.lst.projectlib.util.Preferences;

public class DataBaseHelper extends SQLiteOpenHelper {

	public static final int DATABASE_VERSION = 1;
	public static final String DATABASE_NAME = "yfhdcf_v1_start.db";
	
	public static final String ID = "_id";
	public static final String OTHER_INFO = "other_info";

	public DataBaseHelper(Context context) {
		super(context, new Preferences(context).getUserName() + "_" + DATABASE_NAME,
				null, DATABASE_VERSION);
	}

	public void deleteDataBase(Context context) {
		context.deleteDatabase(new Preferences(context).getUserName() + "_"
				+ DATABASE_NAME);
	}

	private static DataBaseHelper mInstance;

	public synchronized static DataBaseHelper getInstance(Context context) {
		if (mInstance == null) {
			mInstance = new DataBaseHelper(context);
		}
		return mInstance;
	};

	public void resetHelper() {
		if (mInstance != null) {
			mInstance = null;
		}
	}

	@Override
	public void onCreate(SQLiteDatabase arg0) {

	}

	@Override
	public void onUpgrade(SQLiteDatabase arg0, int oldVersion, int newVersion) {

	}
}
